{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 基本使用"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<html>\n",
      " <body>\n",
      "  <p>\n",
      "   html&gt;\n",
      "  </p>\n",
      "  <title>\n",
      "   thie doment story\n",
      "  </title>\n",
      "  <p class=\"title\" name=\"dromouse\">\n",
      "   the domouse's story\n",
      "  </p>\n",
      "  <p class=\"title\" name=\"dromouse\">\n",
      "   the domouse's story\n",
      "  </p>\n",
      " </body>\n",
      "</html>\n",
      "thie doment story\n",
      "\n"
     ]
    }
   ],
   "source": [
    "from bs4 import BeautifulSoup\n",
    "html = '''html><head><title>thie doment story\n",
    "<body>\n",
    "<p class=\"title\" name='dromouse'>the domouse's story</p>\n",
    "<p class=\"title\" name='dromouse'>the domouse's story</p>\n",
    "'''\n",
    "soup = BeautifulSoup(html, 'lxml')\n",
    "print(soup.prettify())\n",
    "print(soup.title.string)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
